﻿// Type: trx2html.ReportGenerator
// Assembly: trx2html, Version=0.7.3.1523, Culture=neutral, PublicKeyToken=null
// Assembly location: C:\Users\jigar\Desktop\Vinay\trx2html_0.7\0.7.3\trx2html.exe

using System;
using System.IO;
using trx2html.Parser;

namespace trx2html
{
  internal class ReportGenerator
  {
    internal static void GenerateReport(string fileName)
    {
      SupportedFormats fileVersion = new VersionFinder().GetFileVersion(fileName);
      if (fileVersion != SupportedFormats.vs2010)
      {
        Console.WriteLine("File {0} is not a recognized as a valid trx. Only VS2010 are supported", (object) fileName);
      }
      else
      {
        Console.WriteLine("Processing {0} trx file", (object) ((object) fileVersion).ToString());
        string html = new HtmlConverter(new TrxParser().Parse(fileName)).GetHtml();
        using (TextWriter textWriter = (TextWriter) File.CreateText(fileName + ".htm"))
          textWriter.Write(html);
        Console.WriteLine("Tranformation Succeed. OutputFile: " + fileName + ".htm\n");
      }
    }
  }
}
